<template>
  <el-form ref="form" :model="form" :rules="rules" label-width="80px" label-position="left">
    <!-- 球队名称 -->
    <el-form-item label="球队名称" prop="name" label-width="100px">
      <el-input
        v-model="form.t_name"
        placeholder="球队名称"
        maxlength="20"
        show-word-limit
      />
    </el-form-item>
    <!-- 学院名称 -->
    <el-form-item label="学院名称" prop="ac_name" label-width="100px">
      <el-input
        v-model="form.ac_name"
        placeholder="学院名称"
        maxlength="20"
        show-word-limit
      />
    </el-form-item>
    <!-- 领队名称 -->
    <el-form-item label="领队名称" prop="tl_name" label-width="100px">
      <el-input
        v-model="form.tl_name"
        placeholder="领队名称"
        maxlength="20"
        show-word-limit
      />
    </el-form-item>
    <!-- 领队联系方式 -->
    <el-form-item label="领队联系方式" prop="tl_tel" label-width="100px">
      <el-input
        v-model="form.tl_tel"
        placeholder="领队联系方式"
        maxlength="20"
        show-word-limit
      />
    </el-form-item>
    <!-- 官方盖章 -->
    <el-form-item label="官方盖章" prop="stamp" label-width="100px">
      <el-upload
        class="avatar-uploader"
        action="http://localhost:5949/team/upload"
        :show-file-list="false"
        :on-success="handleAvatarSuccess">
        <img v-if="imageUrl" :src="imageUrl" class="avatar">
        <i v-else class="el-icon-plus avatar-uploader-icon"></i>
      </el-upload>
    </el-form-item>
    <!-- 审核状态 -->
    <el-form-item label="审核状态" prop="reg_status" label-width="100px">
      <el-tag v-if="form.reg_status === 0" size="mini" type="info">待审核</el-tag>
      <el-tag v-if="form.reg_status === 1" size="mini" type="success">审核通过</el-tag>
      <el-tag v-if="form.reg_status === 2" size="mini" type="danger">审核不通过</el-tag>
    </el-form-item>
  </el-form>
</template>

<script>

export default {
  name: 'TeamInformation',
  props: {
    form: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      imageUrl: undefined
    }
  },
  methods: {
    handleAvatarSuccess() {
      this.form.stamp = 'https://img0.baidu.com/it/u=3803167254,2124079106&fm=253&fmt=auto&app=138&f=JPEG?w=546&h=500'
      this.imageUrl = 'https://img0.baidu.com/it/u=3803167254,2124079106&fm=253&fmt=auto&app=138&f=JPEG?w=546&h=500'
    }
  }
}
</script>

<style scoped>
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
</style>
